home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 February
/
PCWorld_2007-02_cd.bin
/
domacnost a kancelar
/
avedesk
/
AveDesk13.exe
/
Effects
/
MoveItIn.effectlet
< prev
next >
Wrap
Extensible Markup Language
|
2005-10-22
|
5KB
|
228 lines
<?xml version="1.0" encoding="UTF-8"?>
<effectlet>
<info>
<name>MoveItIn Effect Script</name>
<author>Dreadnaut</author>
<notes><![CDATA[ For bugs or anything else, contact me at dreadnaut@despammed.com ]]></notes>
<version>0.0.5</version>
</info>
<settings>
<param name="Debug" type="Boolean" defval="False"/>
</settings>
<preferences>
<preference name="EntranceSide" type="range" defval="0" min="0" max="8">
Select the side from which the desklet will move in
0 - Right side
1 - Bottom side
2 - Left side
3 - Top side
4 - Top/Right corner
5 - Top/Left corner
6 - Bottom/Right corner
7 - Bottom/Left corner
8 - Random !
</preference>
<preference name="screen_Width" type="range" defval="1024" min="800" max="1600">
Your horizontal screen resolution
</preference>
<preference name="screen_Height" type="range" defval="768" min="600" max="1200">
Your vertical screen resolution
</preference>
<preference name="Smoothness" type="range" defval="75" min="0" max="100">
Sets the smoothness of the animation
</preference>
<preference name="Speed" type="range" defval="5" min="1" max="9">
Sets the speed of the slide effect
</preference>
</preferences>
<images>
</images>
<script engine="vbScript"><![CDATA[
Dim InitialTop, InitialLeft
Dim FinalTop, FinalLeft
Dim HMov, VMov, Step
Dim TickRate
Dim State
Dim PrefChange
Dim mySide
'These routines are the optional ones called by the framework
Sub OnCreate()
'Init
FinalTop = Desklet.top
FinalLeft = Desklet.left
'Default preferences
Side = 0
Smoothness = 75
Speed = 5
'And Reading overwrites them with some previous user changes
Preferences.ReadAll()
Evaluate()
Reset()
End Sub
Sub OnMouseOn()
End Sub
Sub OnMouseout()
End Sub
'Function OnBeforeDraw(IsMouseOn, IsSelected, IsPreview)
'End Function
'Function OnAfterDraw(IsMouseOn, IsSelected, IsPreview)
'End Function
Sub OnSave()
Preferences.SaveAll
End Sub
'Optional. Indicates a preference change
Function OnPreferenceChange(Preference, oldValue, newValue)
Reset()
PrefChange = true
End Function
Sub Reset()
Evaluate()
Desklet.move InitialLeft, InitialTop
state = 1
Ticker.Interval = TickRate
Ticker.Enabled = true
End Sub
Sub Evaluate()
if EntranceSide = 8 Then
mySide = cint(Rnd()*7)
Else
mySide = EntranceSide
End If
Select Case mySide
Case 0 ' Right side
InitialTop = FinalTop
InitialLeft = screen_width
Case 1 ' Bottom side
InitialTop = screen_height
InitialLeft = FinalLeft
Case 2 ' Left side
InitialTop = FinalTop
InitialLeft = - Desklet.Width
Case 3 ' Top side
InitialTop = - Desklet.Height
InitialLeft = FinalLeft
Case 4 ' Top/Right corner
InitialTop = - Desklet.Height
InitialLeft = Screen_Width
Case 5 ' Top/Left corner
InitialTop = - Desklet.Height
InitialLeft = - Desklet.Width
Case 6 ' Bottom/Right corner
InitialTop = Screen_Height
InitialLeft = Screen_Width
Case 7 ' Bottom/Left corner
InitialTop = Screen_Height
InitialLeft = - Desklet.Width
Case Else
' duh ? aaargh !
Desklet.label = "MIIE: aaargh!"
End Select
'tickrate in [50 + 0 .. 50 + 200]
TickRate = 50 + cint(200 * (100 - Smoothness) / 100)
Step = 11 - Speed
PrefChange = false
End Sub
'You can only have 1 Ticker per effectlet
'The OnTimer method is shielded against multiple entrance recursion
Sub OnTimer()
If State = 1 Then
If Desklet.left <> FinalLeft Then
HMov = cint((FinalLeft - Desklet.left)/abs(FinalLeft - Desklet.left)) + cint((FinalLeft - Desklet.left) / Step)
Else
HMov = 0
End If
If Desklet.top <> FinalTop Then
VMov = cint((FinalTop - Desklet.top)/abs(FinalTop - Desklet.top)) + cint((FinalTop - Desklet.top) / Step)
Else
VMov = 0
End If
End If
If (HMov <> 0) Or (VMov <> 0) Then
Desklet.Move Desklet.Left + HMov, Desklet.Top + VMov
Else
Desklet.Move FinalLeft, FinalTop
State = 0
Ticker.Enabled = false
End If
'Desklet.Redraw()
End Sub
'Optional calls that we don't need for this script:
'Sub OnSelect()
'End Sub
'Sub OnDeselect()
'End Sub
'Sub OnShow()
'End Sub
'Sub OnHide()
'End Sub
'Sub OnConfigure()
'the configuration dialog with default UI for
'XML preferences will be shown.
'An additional dialog designer is on its way. It will
'extend the available default preferences of type:
' - slider, checkbox, combobox (builtin, v. 1.1, free on form with v. 1.2)
' - textbox, file browser, favorites URL (builtin and free on form, v. 1.2)
' - Any ocx (external, only free on form, v. 1.2)
'End Sub
Sub OnStartMove()
Ticker.Enabled = false
Desklet.move FinalLeft, FinalTop
End Sub
Sub OnEndMove()
FinalTop = Desklet.top
FinalLeft = Desklet.left
Reset()
End Sub
'Sub OnLeftClick()
'End Sub
'Sub OnRightClick()
'End Sub
'Sub OnDestroy
'End Sub
]]></script>
</effectlet>